home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / borland / prbgi097.zip / PASCAL.ZIP / PRTGRAPH.INT < prev    next >
Text File  |  1992-12-15  |  11KB  |  298 lines

  1. {
  2.     Printer BGI driver C interface
  3.     Copyright (c) 1991 A. Resztak
  4.  }
  5.  
  6. unit PRTGraph;
  7.  
  8. Interface
  9.             uses DOS;
  10.  (*    Header file    *)
  11.  
  12.  const    PRT_NO_MEMORY                = 1;
  13.  const    PRT_WRONG_PARAMETERS       = 2;
  14.  const    PRT_NOT_INITIALIZED        = 3;
  15.  const    PRT_IO_ERROR                = 4;
  16.  const    PRT_ERROR                    = 5;
  17.  const   PRT_NO_FILE             = 6;
  18.  const   PRT_USER_INTERRUPT      = 7;
  19.  
  20.  const   PRT_HaltValue                = 100;
  21.  
  22. {$ifdef These_constants_are_defined_in_ PDrivers.pas file }
  23.  
  24.  (*    drivers    *)
  25.  
  26.  const Star_SR9   = 0;
  27.        IBM9          = 1;    (* IBM GraphPrinter,IBM ProPrinter    *)
  28.        EPSON9       = 1;        (* EPSON (graphic mode: Esc,'K'/'L'/'Y'/'Z')    *)
  29.        EPSON9II   = 2;     (* EPSON (graphic mode: Esc,'*',n) *)
  30.          PANASONIC9 = 3;     (* Panasonic KX-P1124 - not tested *)
  31.          IBM9c      = 4;     (* IBM ProPrinter (color) *)
  32.          EPSON9c    = 4;     (* EPSON (color) (graphic mode: Esc,'K'/'L'/'Y'/'Z') *)
  33.          EPSON9IIc  = 5;     (* EPSON (color) (graphic mode: Esc,'*',n) *)
  34.          EPSON24    = 6;     (* 24 pins EPSON compatible printer *)
  35.          IBM24      = 7;     (* 24 pins IBM compatible printer *)
  36.          EPSON24c   = 8;     (* 24 pins EPSON compatible color printer *)
  37.                                     (*  not tested *)
  38.          IBM24c     = 9;     (* 24 pins IBM compatible color printer *)
  39.                                     (*  not tested *)
  40.          PaintJet   = 10;    (* Paint Jet  *)
  41.          HPPaintJet = 11;    (* HP Paint Jet *)
  42.          HPLJ       = 12;    (* Laser Jet *)
  43.          HPLJII     = 13;    (* HP Laser Jet *)
  44.  
  45.  (* modes for particular drivers *)
  46.  
  47.    (* EPSON9   *)
  48.       const  EPSON9_60x72     = 0;
  49.       const  EPSON9_120x72    = 1;
  50.       const  EPSON9_120x216   = 2;
  51.       const  EPSON9_240x216   = 3;
  52.    (* STAR_SR9    *)
  53.       const  STAR_SR9_60x72       = 0;
  54.       const  STAR_SR9_120x72      = 1;
  55.       const  STAR_SR9_120x144     = 2;
  56.       const  STAR_SR9_240x144     = 3;
  57.    (* IBM9     *)
  58.       const  IBM9_60x72       = 0;
  59.       const  IBM9_120x72      = 1;
  60.       const  IBM9_120x216     = 2;
  61.       const  IBM9_240x216     = 3;
  62.    (* EPSON24  *)
  63.       const  EPSON24_60x180    = 0;
  64.       const  EPSON24_120x180   = 1;
  65.       const  EPSON24_180x180   = 2;
  66.       const  EPSON24_360x180   = 3;
  67.       const  EPSON24_360x360   = 4;
  68.    (* IBM24    *)
  69.       const  IBM24_60x180    = 0;
  70.       const  IBM24_120x180   = 1;
  71.       const  IBM24_180x180   = 2;
  72.       const  IBM24_360x180   = 3;
  73.    (* PaintJet   *)
  74.       const  PaintJet_90x90       = 0;
  75.       const  PaintJet_180x180     = 1;
  76.       const  PaintJet_90x90c      = 2;
  77.       const  PaintJet_180x180c    = 3;
  78.    (* HPPJ   *)
  79.       const  HPPJ_90x90       = 0;
  80.       const  HPPJ_180x180     = 1;
  81.       const  HPPJ_90x90c      = 2;
  82.       const  HPPJ_180x180c    = 3;
  83.    (* HP LaserJet   *)
  84.       const  HPLJ_75x75      =  0;
  85.       const  HPLJ_100x100    =  1;
  86.       const  HPLJ_150x150    =  2;
  87.       const  HPLJ_300x300    =  3;
  88.    (* HPLJII   *)
  89.       const  HPLJII_75x75      =  0;
  90.       const  HPLJII_100x100    =  1;
  91.       const  HPLJII_150x150    =  2;
  92.       const  HPLJII_300x300    =  3;
  93.  
  94. {$endif }
  95.  
  96.  (*     P R O C E D U R E S    P R O T O T Y P E S    *)
  97.  
  98. Type
  99.     stringPtr = ^string;
  100.     FnameStr=string[12];
  101.     filePtr = ^file;
  102.  
  103.  
  104. Const
  105.     PRT_HaltPrinting: byte=0;
  106.  
  107.  
  108.  
  109.  
  110. (* Procedures which may be called before initializing PBGI *)
  111. Function PRT_SetPrinterDrv ( drv, mode: word ): integer;
  112. Function PRT_SetPictureInch ( width, height, options: word ): integer;
  113. Function PRT_SetPicturePix ( hPix, vPix, options: word ): integer;
  114. Function PRT_SetDriver ( drv, mode, width, height, options: word ): integer;
  115. Const
  116.     PRT_NORMAL  = 0;
  117.     PRT_ROTATE  = 1;
  118.     PRT_INVERSE = 2;
  119.     PRT_REVERSE = 2;
  120.  
  121. Function PRT_SetDriverFName ( fname: string ): integer;
  122.  
  123. Function PRT_ReadDrivers(directory:DirStr; filename:FnameStr): integer;
  124. Function PRT_LinkDrivers: integer;
  125. Function PRT_End: integer;
  126.  
  127. Function PRT_Buffer ( address: Pointer; size: longint; usable: integer ) : integer;
  128. Function PRT_EMSBuffer ( handle: integer; size: longint; usable: integer ) : integer;
  129. Function PRT_XMSBuffer ( handle: integer; size: longint; usable: integer ): integer;
  130. Function PRT_SetBuffer ( size: longint; BufOpt: word ) : integer;
  131.         Const  NotUseEMS  = 1;
  132.                  NotUseXMS  = 2;
  133. { Function PRT_DefineWorld ( MaxX, MaxY: word ) : integer; }
  134. Function PRT_SetOutName ( DeviceName: string ) : integer;
  135. Function PRT_SetMargins ( left, top: integer ) : integer;
  136. Function PRT_RescaleFillPattern ( r: integer ) : integer;
  137.                                 (* 0 = never, 1 = always , -1 = at high densities only *)
  138.  
  139. Function  PRT_FormFeedNeeded ( ffneeded: integer ): integer;
  140. Procedure PRT_SetHaltVariable(var haltVariable);
  141.  
  142.  (* Procedure allocates PRT buffer, initializes PBGI, calls Draw(),
  143.      closes PBGI, prints picture, and frees the buffer.
  144.      All above is done neccesary number of times to print
  145.      entire picture. *)
  146. Type DrawFuncT = function(UserPointer:pointer): integer;
  147. Function PRT_PrintBGI (    var graphdriver, graphmode: integer;
  148.                                 pathtodriver: string;
  149.                                 Draw: DrawFuncT; UserPointer: pointer ): integer;
  150.  
  151.  
  152.          (* Various informing procedures *)
  153.     (* May be allways called   *)
  154. Function PRT_MaxDriver: integer;
  155. Function PRT_DriverName ( driverno: word; var name_ptr: stringPtr ): integer;
  156. Function PRT_MaxMode ( driverno: word; var maxmode: integer ): integer;
  157. Function PRT_ModeName ( driverno: word; modeno: integer;
  158.                                 var name_ptr: stringPtr ): integer;
  159. Function PRT_ModeParms ( drv, mode: word;
  160.                          var Xres,Yres, colors: word ): integer;
  161. Function PRT_DriverNo: integer;
  162. Function PRT_ModeNo: integer;
  163. Function PRT_errormsg ( errorcode: integer ): string;
  164.  
  165. Function PRT_BufferNeeded ( x1, y1, x2, y2: integer ): longint;
  166. Function PRT_XMSBufferNeeded ( x1, y1, x2, y2: integer ): longint;
  167. Function PRT_Resolution ( var Xres, Yres: integer ): integer;
  168.  
  169.  
  170.  (* Procedure initializes PBGI, calls Draw(), closes PBGI,
  171.      DOES NOT print picture, and DOES NOT allocate or free the buffer *)
  172. Function PRT_BuildBitMap ( var graphdriver, graphmode: integer;
  173.                                     var pathtodriver: string;
  174.                                     x1,y1, x2,y2: integer;
  175.                                     Draw: DrawFuncT; UserPointer: pointer ): integer;
  176.  
  177. (* Procedures which may be called before freeing the buffer *)
  178.  
  179. Function PRT_InitPrt ( var handle: file ): integer;
  180. Function PRT_EndPrt ( var handle: file ): integer;
  181. Function PRT_Send( s: string ): integer;
  182. Function PRT_PrintBuffer ( var handlePtr: filePtr ): integer;
  183. Function PRT_WritePCX ( var handlePtr: filePtr ): integer;
  184. Function PRT_FirstPicPart: boolean;
  185. Function PRT_LastPicPart: boolean;
  186. Function PRT_getpixel ( x, y: integer ): word;
  187. Function PRT_getpixeladdress( var bitno: integer; Bufx, Bufy: integer): pointer;
  188. Procedure setcharsize_Pix ( width,height: integer );
  189. Procedure setfillpattern16 ( upattern: pointer; color: integer );
  190. Procedure getfillpattern16 ( upattern: pointer );
  191.  
  192. Function PRT_AllocateBuffer: integer;
  193. Function PRT_FreeBuffer: integer;
  194.  
  195.  
  196. Function PRT_installuserdriver ( name: string; detectFunc: pointer ): integer;
  197. Function PRT_registerbgidriver ( driver: pointer ): integer;
  198. Function PRT_Unregisterbgidriver ( driver: pointer ): integer;
  199. Function PRT_SetBuildSize( x1, y1, x2, y2: integer ): integer;
  200. Function PRT_initgraph( var graphdriver, graphmode: integer;
  201.                                 pathtodriver: string ): integer;
  202.  
  203. Function PRT_closegraph: integer; { DOES NOT free the buffer   }
  204.  
  205.     Type
  206.         PRT__FilePtr = ^file;
  207.         PRT__ErrorFuncT = Function ( var handle:file): integer;
  208.         PRT__OpenFuncT  = Function ( var outname: string; omode: integer ):
  209.                                  PRT__FilePtr;
  210.         const O_APPEND = $0800;
  211.    Type
  212.         PRT__CloseFuncT = Function ( var handle: file ): integer;
  213.         PRT__WriteFuncT = Function ( var handle: file; buf: pointer;
  214.                                               len: word ): integer;
  215.         PRT__ErrorFuncP = ^PRT__ErrorFuncT;
  216.         PRT__OpenFuncP  = ^PRT__OpenFuncT;
  217.         PRT__CloseFuncP = ^PRT__CloseFuncT;
  218.         PRT__WriteFuncP = ^PRT__WriteFuncT;
  219.  
  220.  Function PRT_SetErrorFunc ( WrErrFunc: PRT__ErrorFuncT ): PRT__ErrorFuncP;
  221.  Function PRT_SetOpenFunc  ( f: PRT__OpenFuncT ): PRT__OpenFuncP;
  222.  Function PRT_SetCloseFunc ( f: PRT__CloseFuncT ): PRT_